<div id="galerie">
    <div id="galerie_overlay"><img alt="" src="templates/default/images/corner-galerie.png" width="25" height="25"></div>
    <div id="galerie_child">

<?php
    $query = mysql_query("select * from dt_header_in_pages where p_id = '1'");
    while ($qrow = mysql_fetch_array($query)){
        if ($qrow['type'] == 'image'){
            echo '<div>';
            echo '<div style="z-index: 2;">';
            $qimg = mysql_query("select * from dt_header_content where h_id = '".$qrow['h_id']."'");
            $qimgrow = mysql_fetch_array($qimg);
            $array = explode("_", $qimgrow['file']);

            $link = mysql_query("select * from dt_header where id = '".$qrow['h_id']."'");
            $linkrow = mysql_fetch_array($link);

            echo '<a style="z-index:2; position: absolute; width: 720px; height: 285px; overflow:hidden" href="'.$linkrow['link'].'"><img src="uploads/head_img/thumbs/thumb_720-'.$qimgrow['file'].'" width="720"></a>';
            echo '</div>';
            $q2 = mysql_query("select * from dt_header where id = '".$qrow['h_id']."'");
            while ($q2row = mysql_fetch_array($q2)){
                echo'<a href="'.$q2row['link'].'">';
                echo '<div class="gallery_picture_text_ctg">'.$q2row['title'].' '.$q2row['subtitle'].'</div>';
                echo'</a>';
            }
            echo '</div>';
        }
        elseif ($qrow['type'] == 'gallery'){
            echo '<div class="gallery_root">';
            echo '<div class="gallery_picture_holder">';
            //<!-- imaginile mari -->
            echo '<div id="pozaMare" style="overflow:hidden; height:285px; width:720px;float:left;">';

            $j=0;
            $images = mysql_query("select * from dt_header_content where h_id = '".$qrow['h_id']."'");
            while ($iRow = mysql_fetch_array($images)){
                $a = explode("_", $iRow['file']);

                $link = mysql_query("select * from dt_header where id = '".$qrow['h_id']."'");
                $linkrow = mysql_fetch_array($link);

                echo '<div id="poza'.$j.'">';
                echo '<a style="z-index:99; position: absolute; width: 100%; height: 285px; overflow:hidden" href="'.$linkrow['link'].'">';
                echo '<img src="uploads/head_img/thumbs/thumb_720-'.$iRow['file'].'" width="720">';
                echo '</a>';
                echo '</div>';
                $j++;
            }
            echo '</div>';
            //<!-- end imaginile mari -->
            echo '</div>';
            echo '<div class="gallery_picture_text">';
            //<!-- text imagini -->
            $images = mysql_query("select * from dt_header where id = '".$qrow['h_id']."'");
            $iRowT = mysql_fetch_array($images);

            echo trimthem($iRowT['title']).' '.trimthem($iRowT['subtitle']);
            //<!-- end text imagini -->
            echo '</div>';
            echo '<div class="gallery_slider_holder">';
            //<!-- thumbs slider -->
            echo '<div id="thumb" style="float:right;">';
            echo '<ul id="scroller">';

            $j=0;
            $images = mysql_query("select * from dt_header_content where h_id = '".$qrow['h_id']."'");
            while ($iRow = mysql_fetch_array($images)){
                $b = explode("_", $iRow['file']);
                echo '<li id="clickPoza'.$j.'"><div class="thumbsize" style="background:url(uploads/head_img/thumbs/thumb_95-'.$iRow['file'].');"><img src="templates/default/images/chenar-alb-60x60.png" width="60" height="60"></div></li>';
                $j++;
            }
            echo '</ul>';
            echo '</div>';
            //<!-- end thumbs slider -->
            echo '</div>';
            echo '</div>';
        }
        elseif ($qrow['type'] == 'playclick'){
            echo '<div id="wrapper">';
            echo '<div id="slider-wrapper" class="slider-wrapper">';
            echo '<div id="slider" class="nivoSlider">';

            $images = mysql_query("select * from dt_header_content where h_id = '".$qrow['h_id']."'");
            while ($iRow = mysql_fetch_array($images)){
                $array = explode("_", $iRow['file']);
                $linkoferte = mysql_query("select * from dt_header where id = '".$qrow['h_id']."'");
                $linkrow = mysql_fetch_array($linkoferte);
                echo '<a style="z-index:19; position: absolute; width: 100%; height: 285px" href="'.$linkrow['link'].'"><img src="uploads/head_img/thumbs/thumb_720-'.$iRow['file'].'" alt="" width="720" height="285" title="#htmlcaption" /></a>';
            }
            echo '</div>';
            echo '<div id="butonplay"></div>';
            echo '<div id="htmlcaption" class="nivo-html-caption">';

            $images = mysql_query("select * from dt_header where id = '".$qrow['h_id']."'");
            $iRowT = mysql_fetch_array($images);
            echo trimthem($iRowT['title']).' '.trimthem($iRowT['subtitle']);
            echo '</div>';
            echo '</div>';
            echo '</div>';
        }
        elseif ($qrow['type'] == 'swf'){
            $head = mysql_query("select * from dt_header_content where h_id = '".$qrow['h_id']."'");
            while ($headrow = mysql_fetch_array($head)){
                echo '<object width="720" height="285"><param name="movie" value="uploads/multimedia/'.$headrow['file'].'"><embed src="uploads/multimedia/'.$headrow['file'].'" width="720" height="285"></embed></object>';
            }
        }
    }
?>
    </div>
</div>